package cn.lg.soar.system.auth.model;

import cn.lg.soar.common.data.tree.ITreeResult;
import cn.lg.soar.common.util.BeanCopier;
import cn.lg.soar.system.auth.entity.Menu;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;

/**
 * 菜单树形数据
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Getter
@Setter
public class MenuTree implements ITreeResult<MenuTree>, Serializable {

    private final static BeanCopier<Menu, MenuTree> FROM_ENTITY = BeanCopier.create(Menu.class, MenuTree.class);
    private static final long serialVersionUID = -2670893230367311406L;

    @JsonIgnore
    private Long id;

    private Integer type;

    private String code;

    private String path;

    private String redirect;

    private String component;

    private String title;

    private String icon;

    private Integer status;

    private Boolean hideChildren;

    private Boolean shared;

    private Boolean keepalive;

    private Integer sort;

    private List<MenuTree> children;

    public MenuTree() {
    }

    public MenuTree(Menu data) {
        FROM_ENTITY.copy(data, this);
        this.id = data.getId();
    }

}
